<template>
  <div class="onDuty">
    <searchBar :activeIndex="props.activeIndex" @changeNav="changeNav"></searchBar>
    <div class="onDuty_content">
      <div class="btn">
        <div class="btn_item" @click="pushAdd">
          <img class="btn_icon" src="@/assets/images/images_new/add_icon.png" alt="">
          <span>新增</span>
        </div>
        <div class="btn_item" @click="pushConfig">
          <img class="btn_icon" src="@/assets/images/images_new/add_icon.png" alt="">
          <span>班组配置</span>
        </div>
        <div class="btn_item">
          <img class="btn_icon" src="@/assets/images/images_new/del_icon.png" alt="">
          <span>批量编辑</span>
        </div>
      </div>
      <div class="content_bg">
        <div class="dayInfo">
          <span>2024-05-02 值班信息：夜班 —— 四值，白班 —— 一值，中班 —— 三值</span>
        </div>
        <div class="table_content">
          <onDutyTable></onDutyTable>
          <onDutyTable></onDutyTable>
          <onDutyTable></onDutyTable>
          <onDutyTable></onDutyTable>
          <onDutyTable></onDutyTable>
        </div>

      </div>
    </div>
  </div>
</template>

<script setup lang="ts">
import router from "@/routes";
import searchBar from "./searchBar.vue";
import onDutyTable from "./table.vue";
const props = defineProps({
  activeIndex: {
    type: Number,
    default: 0
  }
})

let emit = defineEmits(['changeNav'])

const changeNav = (index: number) => {
  emit('changeNav', index)
}

const pushAdd = ()=>{
  router.push('/integratedServices/addOnDuty');
}

//班组配置
const pushConfig = ()=>{
  router.push('/integratedServices/teamConfig_onDuty');
}
</script>

<style lang="scss" scoped>
.onDuty {
  display: flex;
  flex-direction: column;
  height: 100%;

  .onDuty_content {
    flex: 1;
    min-height: 0;

    .btn {
      display: flex;
      justify-content: flex-end;
      align-items: center;
      height: 40px;
      padding-right: 25px;
      color: rgb(112, 105, 95);
      font-size: 14px;

      .btn_item {
        display: flex;
        align-items: center;
        margin-left: 20px;
        cursor: pointer;
        height: 28px;
        line-height: 28px;
        padding: 0 10px 0 8px;

        &:hover {
          background: rgba(0, 0, 0, 0.1);
          border-radius: 2px;
        }

        .btn_icon {
          width: 18px;
          margin-right: 6px;
        }
      }
    }

    .content_bg {
      height: calc(100% - 40px);
      background-color: #fff;
      border-radius: 8px;
      // padding: 10px 0;
     padding-top: 10px;
      display: flex;
      flex-direction: column;

      .dayInfo {
        padding-left: 20px;
        margin-bottom: 10px;
        height: 24px;
      }
      .table_content {
        padding: 0 20px;
        overflow-y: scroll;
        flex: 1;
      }
    }
  }
}
</style>
